package com.seguriapp.configuration;

import org.apache.log4j.Logger;

/**
 * Loads the configuration file of the application.
 */
public class GlobalConfigLoader {

  private static final Logger LOGGER = Logger.getLogger(GlobalConfigLoader.class);

  private GlobalConfig globalConfig;

  private static final GlobalConfigLoader INSTANCIA = new GlobalConfigLoader();

  /**
   * @return The only instance of the global config loader.
   */
  public static GlobalConfigLoader getInstance() {
    return INSTANCIA;
  }

  public void init(Object o) {
    if (o instanceof GlobalConfig) {
      globalConfig = (GlobalConfig) o;
    } else {
      LOGGER.info("Error loading GlobalConfig file");
    }
  }

  /**
   * @return Global configurations
   */
  public GlobalConfig getGlobalConfig() {
    return globalConfig;
  }

}
